package com.qtu.order_service.openfeign;

//import com.qtu.order_service.openfeign.impl.RedisFeignClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author CaiYinWei
 * @create 2020-07-08 16:34
 */
@FeignClient(value = "redis-service")
@Component
public interface RedisFeignClient {
    /**
     * 向redis中存对象并设置过期时间
     * @param key
     * @param value
     * @param time
     * @return
     */
    @ResponseBody
    @RequestMapping("api/redis/setByTime")
    public String setByTime(@RequestParam("key") String key, @RequestBody Object value, @RequestParam("time")long time);

    @ResponseBody
    @RequestMapping(value = "api/redis/set")
    public String set(@RequestParam("key") String key, @RequestBody Object value);

    @ResponseBody
    @RequestMapping("api/redis/get")
    public Object get(@RequestParam("key") String key);
}
